

<?php

/**
 * @author christian
 * @copyright 2011
 *  
 */
 

 //establecer una variable conratafisica $_LOCALHOST
$ruta=$_SERVER['DOCUMENT_ROOT']."/viventura"."/MDTour";
include_once("$ruta/star.php");
//include_once("$rut/conf/CConfig.php");


/** Datos del paquete-tour  */
 
if (!isset($_GET['default'])) {$_GET['default'] = "NULL"; }
if (!isset($_GET['servicio'])) {$_GET['servicio'] = "NULL"; }


if (!isset($_POST['idRest'])) {$_POST['idRest'] = "NULL"; }
if (!isset($_POST['NomRes'])) {$_POST['NomRes'] = "NULL"; }
if (!isset($_POST['TypRes'])) {$_POST['TypRes'] = "NULL"; }
if (!isset($_POST['DirRes'])) {$_POST['DirRes'] = "NULL"; }
if (!isset($_POST['FirstConRes'])) {$_POST['FirstConRes'] = "NULL"; }
if (!isset($_POST['LastConRes'])) {$_POST['LastConRes'] = "NULL"; }
if (!isset($_POST['PostCodRes'])) {$_POST['PostCodRes'] = "NULL"; }
if (!isset($_POST['TelRes'])) {$_POST['TelRes'] = "NULL"; }
if (!isset($_POST['MovRes'])) {$_POST['MovRes'] = "NULL"; }
if (!isset($_POST['FaxRes'])) {$_POST['FaxRes'] = "NULL"; }
if (!isset($_POST['WebSitRes'])) {$_POST['WebSitRes'] = "NULL"; }
if (!isset($_POST['StarRes'])) {$_POST['StarRes'] = "NULL"; }


$servicio=$_GET['servicio'];
$default=$_GET['default'];

$idRest=$_POST['idRest'];
$NomRes=$_POST['NomRes'];
$TypRes=$_POST['TypRes'];
$DirRes=$_POST['DirRes'];
$FirstConRes=$_POST['FirstConRes'];
$LastConRes=$_POST['LastConRes'];
$PostCodRes=$_POST['PostCodRes'];
$TelRes=$_POST['TelRes'];
$MovRes=$_POST['MovRes'];
$FaxRes=$_POST['FaxRes'];
$WebSitRes=$_POST['WebSitRes'];
$StarRes =$_POST['StarRes'];


if($default==1){ // registrar
   

                $querybasic = "insert into restaurant (idRest,NomRes,TypRes,DirRes,FirstConRes,LastConRes,PostCodRes,TelRes,MovRes,FaxRes,WebSitRes,StarRes) 
                 values ('NULL','$NomRes','$TypRes','$DirRes','$FirstConRes','$LastConRes','$PostCodRes','$TelRes','$MovRes','$FaxRes','$WebSitRes','$StarRes')";
                echo $querybasic;
                $idExt = CModelo::getInstance()->insertData($querybasic);

                 //echo "<script> parent.location.href = 'CExtensiones.php?codigo=$idPackTour' </script>";
    }

else{ // actualizar
     
       
    }
    
if($servicio==1){
    
    
    if (!isset($_POST['idRest'])) {$_POST['idRest'] = "NULL"; }
    if (!isset($_POST['DesRes'])) {$_POST['DesRes'] = "NULL"; }
    if (!isset($_POST['CanIteRec'])) {$_POST['CanIteRec'] = "NULL"; }
    if (!isset($_POST['PriUni'])) {$_POST['PriUni'] = "NULL"; }
    if (!isset($_POST['CommSer'])) {$_POST['CommSer'] = "NULL"; }

    $idRest =$_POST['idRest'];
    $DesSer=$_POST['DesSer'];
    $CanIteRec=$_POST['CanIteRec'];
    $PriUni=$_POST['PriUni'];
    $CommSer=$_POST['CommSer'];
    

    
    
    //DesSer"=>"Nombre del servicio","CanIteRec"=>"Cantidad","PriUni"=>"Precio Unitario"
    $qu = "insert into restaurant_has_pack_has_tour (restaurant_idRest,DesSer,CanIteRec,PriUni,CommSer,SerFlag) 
    values ('$idRest','$DesSer','$CanIteRec','$PriUni','$CommSer','1')";

    $idSer = CModelo::getInstance()->insertData($qu);
 
}
        
 
//include_once("$rut/elements/head.tpl");
include_once("$rut/elements/foot.tpl");


echo "<script> parent.location.href = '/viventura/MDRestaurantes/index.php' </script>"; 
       




?>